/*****************************************************************************
 * MODULE NAME:    hcit_generic.h
 * PROJECT CODE:   Bluetooth
 * DESCRIPTION:    HCI Generic Transport Interface Header
 * MAINTAINER:     Dave Airlie
 * CREATION DATE:  19 April 2000
 *
 * SOURCE CONTROL: $Id: hcit_generic.h,v 1.1 2008/11/10 10:29:42 tianwq Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2000 SSL
 *     All rights reserved.
 *
 * SOURCE:         
 * ISSUES:         <none>
 * NOTES TO USERS: <none>
 *
 *****************************************************************************/

#ifndef HCIT_GENERIC_H
#define HCIT_GENERIC_H

#include "sys_types.h"
#include "sys_config.h"


/* Types of Transport mechanisms */
typedef enum 
{
  HCIT_FAST_IRQ,
  HCIT_SLOW_IRQ,
  HCIT_POLLED
} t_hcit_trans_type;

typedef struct 
{
  t_hcit_trans_type type;
  
  /* Functions to initialise, transmit a block, poll receiver, intr receiver */
  int (*init)(void);
  int (*transmit)(u_int8 *data, u_int32 block_length, u_int8 queue_id, t_deviceIndex index);
  int (*poll_rx)(void);
  int (*intr_handle)(void);
  
  boolean tx_busy;
  t_deviceIndex tx_device_index;
  t_deviceIndex rx_device_index;

} t_hcit_trans_info;

extern t_hcit_trans_info sys_hci_transport;
unsigned char *HCit_Generic_Get_Rx_Buf(u_int8 ptype,int size, u_int8 *hci_header);
unsigned int HCit_Generic_Commit_Rx_Buf(unsigned int buf_cont_type);
unsigned int HCit_Generic_Acknowledge_Complete_Tx(unsigned int queue, unsigned int buf_len);

void HCit_Dispatch_Pending_Data(void);
void HCit_Dispatch_Pending_Event(void);


#define HCIT_COMMAND 0x1
#define HCIT_ACLDATA 0x2
#define HCIT_SCODATA 0x3
#define HCIT_EVENT   0x4

#endif
